package 软件工程实验三.A1.A13;

public class Client {
    public static void main(String[] args) {
        School three = new School("三峡大学");
        Department computerScienceAndTechnologyDepartment = new Department("计算机科学与技术学院");
        Department physicsAndEngineeringDepartment = new Department("物理科学与工程学院");

        Student guanYu = new Student("关羽");
        Student zhaoYun = new Student("赵云");

        Instructor caoCao = new Instructor("曹操");
        Instructor zhuGeLiang = new Instructor("诸葛亮");

        Subject javaCourse = new Subject("Java程序设计");
        Subject dataStructureCourse = new Subject("数据结构");
        Subject physicsCourse = new Subject("物理");
        Subject mechanicsCourse = new Subject("力学");

        // 添加院系到学校
        three.addDepartment(computerScienceAndTechnologyDepartment);
        three.addDepartment(physicsAndEngineeringDepartment);

        // 添加课程、教师和学生到院系
        computerScienceAndTechnologyDepartment.addSubject(javaCourse);
        computerScienceAndTechnologyDepartment.addSubject(dataStructureCourse);
        physicsAndEngineeringDepartment.addSubject(physicsCourse);
        physicsAndEngineeringDepartment.addSubject(mechanicsCourse);
        computerScienceAndTechnologyDepartment.addInstructor(zhuGeLiang);
        physicsAndEngineeringDepartment.addInstructor(caoCao);
        computerScienceAndTechnologyDepartment.addStudent(guanYu);
        physicsAndEngineeringDepartment.addStudent(zhaoYun);

        // 添加学生到课程
        physicsCourse.addStudent(zhaoYun);
        mechanicsCourse.addStudent(guanYu);
        zhaoYun.addSubject(physicsCourse);
        guanYu.addSubject(mechanicsCourse);

        //添加教师到课程
        javaCourse.addInstructor(zhuGeLiang);
        dataStructureCourse.addInstructor(caoCao);
        zhuGeLiang.addSubject(javaCourse);
        caoCao.addSubject(dataStructureCourse);

        System.out.println("学校名称：" + three.getName());
        for(Department item : three.theDepartment) {
            System.out.println("院系名称：" + item.getName());
            for(Subject subject : item.theSubject) {
                System.out.println("\t课程名称：" + subject.getName());
                for(Student student : subject.theStudent) {
                    System.out.println("\t\t学生姓名：" + student.getName());
                    for(Subject sub : student.theSubject) {
                        System.out.println("\t\t\t学习的课程名称：" + sub.getName());
                    }
                }
                for(Instructor instructor : subject.theInstructor) {
                    System.out.println("\t\t教师姓名：" + instructor.getName());
                    for(Subject sub : instructor.theSubject) {
                        System.out.println("\t\t\t教授的课程名称：" + sub.getName());
                    }
                }
            }
        }
    }
}
